package com.fc.common.security.feign;

import feign.RequestInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.security.oauth2.server.resource.web.BearerTokenResolver;

/**
 * @Description:
 * @ClassName: FcFeignClientConfiguration
 * @Author: weisn
 * @Date: 2022/12/20 16:59
 * @Version: 1.0
 */
public class FcFeignClientConfiguration {
    /**
     * 注入 oauth2 feign token 增强
     * @param tokenResolver token获取处理器
     * @return 拦截器
     */
    @Bean
    public RequestInterceptor oauthRequestInterceptor(BearerTokenResolver tokenResolver) {
        return new FcOAuthRequestInterceptor(tokenResolver);
    }
}
